require('module-alias/register')
var { sunnyEquipmentInfo } = require('@Sequelize')

function upload(req, res, next) {
    var nowDay = moment().format('YYYY-MM-DD/');
    var savePath = filePath + nowDay
    var hasFilePath = fs.existsSync(resolve(savePath))
    if (!hasFilePath) {
        fs.mkdirSync(savePath);
    }
    let form = new multiparty.Form({ uploadDir: resolve(savePath) });
    form.parse(req, function (err, fields, files) {
        if (err) {
            res.send(new CustomError(err))
        } else {


            res.send(new CustomSuccess(files.file))
        }

    });
}
module.exports = { upload };